<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!doctype html>
 <html lang="zh-CN">
 <head>
   <meta charset="UTF-8">
   <%@ include file="/share/systemInclude.jsp" %>
   
   <script type="text/javascript">
      $(function(){  
        $(".list_table").colResizable({
          liveDrag:true,
          gripInnerHtml:"<div class='grip'></div>", 
          draggingClass:"dragging", 
          minWidth:30
        }); 
      });
      
      function search(id){
      	$('#'+id).submit();
      }
      
      function deletedletter(id,title){
      	art.dialog({
			width: 250,
			height: 100,
			fixed: true,
		    padding: 0,
		    title: "删除提示",
		    content: "是否确认<font style='color:red'>删除</font>标题为 "+title+" 的站内信？",
		    lock: true,
		    button: [{
			    name: "确定",
			    callback: function () {
			    	$.ajax({
						 url: "${root}/control/letter/letterController/deletedLetter.do?",
						 data: {
						 	"letterId":id
						 },
						 type: "post",
						 success: function(data){
				        	if(data=="true"){
				        		var url = '${root }/control/letter/letterController/sysLetterList.do?page=${pageView.currentpage}&';
								var param = $('#searchForm').serialize();
								url = url+param;
				        		artDalog("删除提示","站内信 "+title+" 删除成功",url);
				        		//search("searchForm");
				        	}else{
				        		artDalog("错误信息","站内信 "+title+" 不存在，无法删除！",null);
				        	}
				      	}
				   	});
			    },
		        focus: true
		     },
		     {
		        name: "取消"
		     }]
		});
      }
   </script>
   <title>Document</title>
 </head>
 <body>
  <div class="container">
    <div id="search_bar" class="">
       <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">搜索</b></div>
            <div class="box_center pt10 pb10">
            	<form id="searchForm" action="${root }/control/letter/letterController/sysLetterList.do" method="post">
			  		<table class="form_table" bletter="0" cellpadding="0" cellspacing="0">
			  			<tr>
			  				<td>标题:</td>
			  				<td><input type="text" name="letterTitle" value="${fn:escapeXml(form.letterTitle)}" class="input-text lh30" size="40" /></td>
			  				<td>店铺:</td>
			  				<td><input type="text" name="letterShopName" value="${fn:escapeXml(form.letterShopName)}" class="input-text lh30" size="40" /></td>
			  				<td>用户:</td>
			  				<td><input type="text" name="letterUserName" value="${fn:escapeXml(form.letterUserName)}" class="input-text lh30" size="40" /></td>
			  				<%-- <td>店铺:</td>
			  				<td><input type="text" name="shop.shopName" value="${fn:escapeXml(form.shop.shopName)}" class="input-text lh30" size="40" /></td>
			  				<td>用户:</td>
			  				<td><input type="text" name="user.userName" value="${fn:escapeXml(form.user.userName)}" class="input-text lh30" size="40" /></td> --%>
			  				<td><input type="button" name="button" class="btn btn82 btn_search" onclick="search('searchForm');" value="查询"> </td>
			  			</tr>
			  		</table>
			  	</form>
            </div>
          </div>
        </div>
    </div>
     <div id="table" class="mt10">
        <div class="box span10 oh">
              <table width="100%" bletter="0" cellpadding="0" cellspacing="0" class="list_table">
                <tr>
                   <th width="60">站内信标题</th>
                   <th width="60">店铺名称</th>
                   <th width="60">用户名称</th>
                   <th width="180">站内信内容</th>
                   <th width="100">创建时间</th>
                   <th width="65">操作</th>
                   <th width="55">查看</th>
                </tr>
                <c:if test="${not empty pageView.records }">
	  				<c:forEach items="${pageView.records }" var="entity">
	  					<tr class="tr">
		                   <td>${fn:escapeXml(entity.letterTitle)}</td>
		                   <td>${fn:escapeXml(entity.letterShopName)}</td>
		                   <td>${fn:escapeXml(entity.letterUserName)}</td>
		                   <td><span title="${fn:escapeXml(entity.letterContent)}">${fn:escapeXml(entity.letterContent)}</span></td>
		                   <td align="center"><fmt:formatDate value="${entity.letterCreateTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
		                   <td align="center">
	                   			<input type="button" name="button" class="btn btn82 btn_del" onclick="deletedletter('${entity.letterId}','${entity.letterTitle}')" value="删除">
		                   </td>
		                   <td align="center"><input type="button" name="button" class="btn btn82 btn_search" onclick="window.location.href='${root }/control/letter/letterController/dispalySysDetail.do?letterId=${entity.letterId }'" value="详情"></td>
		                </tr>
	  				</c:forEach>
	  			</c:if>
	  			<c:if test="${empty pageView.records }">
	  				
	  			</c:if>
              </table>
              <%@ include file="/share/systemPagination.jsp" %>
        </div>
     </div>
   </div> 
 </body>
 </html>
  